package com.qlm.controller;

import java.util.List;

import com.jfinal.aop.Before;
import com.jfinal.core.Controller;
import com.qlm.entity.HB;
import com.qlm.interceptor.AdminOperateInterceptor;
import com.qlm.interceptor.AuthInterceptor;
import com.qlm.service.IHBManageService;
import com.qlm.service.impl.HBManageServiceImpl;
import com.qlm.view.ResultMessage;

@Before({AuthInterceptor.class , AdminOperateInterceptor.class})
public class HBManageController extends Controller {
	
	private IHBManageService HBManageService = enhance(HBManageServiceImpl.class);
	
	public void getAllHB(){
		List<HB> list = HBManageService.getAllHB();
		setAttr("hbList", list);
		renderJsp("/page/hbinit.jsp");
	}
	
	/**
	 * 保存红包
	 */
	public void saveHb(){
		String[] money_ = getParaValues("money");
		Integer[] cost_ = getParaValuesToInt("cost");
		ResultMessage rm = HBManageService.saveHb(money_, cost_);
		renderJson(rm);
	}
}
